(function(){

var myfs = require("../_include/fs");
var ResponObj = require("../_include/responObj");
var theme = {
	hasTheme:function(theme_name){
		return myfs.fs.existsSync("_bus_theme/"+theme_name);
	},
	initBusTheme:function(bus_name,theme_name){
		theme_name||(theme_name = "default");
		if (theme.hasTheme(theme_name)) {
			myfs.copy("_bus_theme/"+theme_name,"_bus_instance/"+bus_name);
			return ResponObj("json","商家注册成功");
		}else{
			return ResponObj("error","找不到指定的风格包");
		}
	},
	changeBusTheme:function(bus_name,theme_name){
		theme_name||(theme_name = "default");
		if (theme.hasTheme(theme_name)) {
			myfs.copy("_bus_theme/"+theme_name+"/css","_bus_instance/"+bus_name+"/css");
			return ResponObj("json","商家风格修改成功");
		}else{
			return ResponObj("error","找不到指定的风格包");
		}
	}
};
module.exports = theme;

}());
